package br.com.j7.jdesk.ui.bean;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import br.com.j7.jdesk.persistence.entity.SMS;
import br.com.j7.jdesk.persistence.repository.SMSRepository;
import br.com.j7.jdesk.persistence.repository.impl.SMSRepositoryImpl;

@ManagedBean(name="smsBean")
@RequestScoped
public class SMSBean extends WebContext {

	private SMS sms = new SMS();
	private SMSRepository smsRepository;
	
	public SMSBean() {
		smsRepository = new SMSRepositoryImpl();
	}
	
	public String adicionar() {
		try {
			smsRepository.add(sms);
			sms = new SMS();
			
			return "sms";
		} catch (Exception e) {
			throw new RuntimeException(e);
		}

	}
	
	public SMS getSms() {
		return sms;
	}
	
	public void setSms(SMS sms) {
		this.sms = sms;
	}
}
